//
//  kWSimpleItem.m
//  EasyToTesco2.0
//
//  Created by 杨森 on 2017/6/2.
//  Copyright © 2017年 EasyToTesco. All rights reserved.
//

#import "kWSimpleItem.h"
#import "kWHomeModel.h"

@interface  kWSimpleItem()

@property(nonatomic,strong)UIImageView   *contentImg;

@end

@implementation kWSimpleItem

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        self.contentView.backgroundColor = [UIColor whiteColor];
        [self buildSubViews];
    }
    return self;
}

- (void)buildSubViews
{
    [self.contentView addSubview:self.contentImg];
}


- (void)layoutSubviews
{
    [super layoutSubviews];
    self.contentImg.frame = CGRectMake(0,0,self.width, self.Height);
    
}

- (void)setHomeModel:(kWHomeModel *)homeModel
{
    _homeModel = homeModel;
    NSURL *url = [NSURL URLWithString:homeModel.img];
    [self.contentImg sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"placeholder"]];
}


#pragma mark lazy
- (UIImageView *)contentImg
{
    if (!_contentImg) {
        _contentImg = [[UIImageView alloc] init];
        _contentImg.image = [UIImage imageNamed:@"kW_3d_bg"];
    }return _contentImg;
}




@end
